package com.sesame.controller;

import lombok.Data;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;

import java.util.Arrays;
import java.util.Date;

@Controller
@RequestMapping("/test")
public class TestController {

    @RequestMapping("/list")
    public String list(ModelMap map) {
        map.put("list", Arrays.asList(
                new User("1", "张三", new Date())
                , new User("2", "李四", new Date())
                , new User("3", "王五", new Date())
        ));

        return "index";
    }

    @Data
    public class User {
        private String id;
        private String name;
        private Date time;

        public User() {
        }

        public User(String id, String name, Date time) {
            this.id = id;
            this.name = name;
            this.time = time;
        }
    }
}
